package bdqn.t09.controller;

import bdqn.t09.pojo.AsAccountdetail;
import bdqn.t09.service.AsAccountdetailService;
import bdqn.t09.util.Pageinfo;
import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class AsAccountdetailController {

    @Resource
    private AsAccountdetailService asAccountdetailService;

    @RequestMapping("show")
    @ResponseBody
    public Object shows(@RequestParam(defaultValue = "1") Integer page,
                        @RequestParam(defaultValue = "10") Integer rows){
        Pageinfo pageinfo = asAccountdetailService.selectAsAccountdetailMapper(page,rows);
        Map map = new HashMap();
        map.put("rows",pageinfo.getList());
        map.put("total",pageinfo.getCount());
        return map;
    }

    //查询所有数据（账户余额报表）
    @RequestMapping(value = "accountdetailInfo",method = RequestMethod.GET)
    @ResponseBody
    public Object list(String detailDateTime1,String detailDateTime2){
        List<AsAccountdetail> asAccountdetails1 = asAccountdetailService.asAccountdetailList1();
        List<AsAccountdetail> asAccountdetails2 = asAccountdetailService.asAccountdetailList2(detailDateTime1,detailDateTime2);
        List<AsAccountdetail> asAccountdetails3 = asAccountdetailService.asAccountdetailList3(detailDateTime1,detailDateTime2);
        //System.out.println(JSON.toJSONString(asAccountdetails));
        Map map = new HashMap();
        map.put("asA1",asAccountdetails1);
        map.put("asA2",asAccountdetails2);
        map.put("asA3",asAccountdetails3);
        return map;
    }

    @RequestMapping("toshow")
    public String toshow(){
        return "AsAccountdetail";
    }

}
